package cs3343.project.family;

import cs3343.project.family.UI.*;

public class UIController {
	
	private GameController gc;
	
	private CharacterFrame characterFrame;
	private EndGameFrame endgameFrame;
	private GameFrame gameFrame;
	private cs3343.project.family.UI.EventCardFrame eventcardFrame;
	private cs3343.project.family.UI.ToolCardFrame toolcardFrame;
	private cs3343.project.family.UI.YesNoFrame yesnoFrame;
	
	private ProfileCreateFrame profileCreateFrame;
	
	public UIController(GameController gc) {
		this.gc = gc;
	}
	
	public void showMainWindow() {
		
	}
	
	public void showCharacterFrame() {
		if (characterFrame == null)
			characterFrame = new CharacterFrame(gc);
		characterFrame.setVisible(true);
	}
	
	public void hideCharacterFrame() {
		characterFrame.setVisible(false);
	}
	
	public void showGameFrame(int noOfPlayers) {
		if (gameFrame == null) {
			int[] dimension = new int[2];
			if (noOfPlayers <= 2) {
				dimension[0] = 800;
				dimension[1] = 700;
			}
			else if (noOfPlayers > 2 && noOfPlayers <= 4) {
				dimension[0] =  1000;
				dimension[1] = 700;
			}
			else {
				dimension[0] = 1200;
				dimension[1] = 700;
			}
			gameFrame = new GameFrame(dimension[0], dimension[1], gc);
		}
		gameFrame.setVisible(true);
	}
	
	public void hideGameFrame() {
		gameFrame.setVisible(false);
	}
	
	public void showEndGameFrame() {
		if (endgameFrame == null)
			endgameFrame = new EndGameFrame();
		endgameFrame.setVisible(true);
	}
	
	public void hideEndGameFrame() {
		endgameFrame.setVisible(false);
	}
	
	public void showProfileCreateFrame() {
		if (profileCreateFrame == null)
			profileCreateFrame = new ProfileCreateFrame();
		profileCreateFrame.setVisible(true);
	}
	
	public void hideProfileCreateFrame() {
		profileCreateFrame.setVisible(false);
	}
	
	public void showEventCardFrame(Card card, Character character) {
		//if (eventcardFrame == null)
			eventcardFrame = new cs3343.project.family.UI.EventCardFrame(character, card, gc);
		eventcardFrame.setVisible(true);
	}
	
	public void hideEventCardFrame() {
		eventcardFrame.setVisible(false);
	}
	
	public void showToolCardFrame(Card card, Character character, String type) {
		//if (toolcardFrame == null)
			toolcardFrame = new cs3343.project.family.UI.ToolCardFrame(character, card, type);
		//toolcardFrame.setVisible(true);
	}
	
	public void hideToolCardFrame() {
		toolcardFrame.setVisible(false);
	}
	
	public void showYesNoFrame(Card card, Character character, String type) {
		//if (yesnoFrame == null)
			yesnoFrame = new cs3343.project.family.UI.YesNoFrame(character, card, type);
		//yesnoFrame.setVisible(true);
	}
	
	public void hideYesNoFrame() {
		yesnoFrame.setVisible(false);
	}
	
	
	
	
	
	
	
	
	// GETTER & SETTER

	public CharacterFrame getCharacterFrame() {
		return characterFrame;
	}

	public void setCharacterFrame(CharacterFrame characterFrame) {
		this.characterFrame = characterFrame;
	}

	public EndGameFrame getEndgameFrame() {
		return endgameFrame;
	}

	public void setEndgameFrame(EndGameFrame endgameFrame) {
		this.endgameFrame = endgameFrame;
	}

	public GameFrame getGameFrame() {
		return gameFrame;
	}

	public void setGameFrame(GameFrame gameFrame) {
		this.gameFrame = gameFrame;
	}

}
